import socket
import time

for i in range(1, 2):
    mysocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    mysocket.connect(('192.168.10.110', 2425))

    # IPMSG的报文格式: 版本号:包编号:发送者姓名:发送者主机名:命令字:附加信息
    packetID = str(time.time())
    name = 'Administrator'
    host = 'localhost'
    command = str(0x00000020)
    content = 'This is the message from Python'
    #   构建消息体
    message = 'a.txt.0:' + packetID + ':' + name + ':' + host + ':' + command + ':' + content

    mysocket.send(message.encode('GBK'))
    mysocket.close()
